Humanities/Arts Exam  >  Humanities/Arts Questions  >  The given array is a = {7,8,9,6,5}. The numbe... Start Learning for Free
 The given array is a = {7,8,9,6,5}. The number of iterations in selection sort and bubble sort respectively are __________.
  • a)
    4 and 4.
  • b)
    5 and 4.
  • c)
    3 and 5
  • d)
    5 and 5
Correct answer is option 'A'. Can you explain this answer?
Most Upvoted Answer
The given array is a = {7,8,9,6,5}. The number of iterations in select...
The selection sort algorithm sorts an array by repeatedly finding the minimum element from the unsorted part and putting it at the beginning.So, Every pass 1 swap minimum is required.
The selection sort is good for swapping purposes.
According to the question , the array is {7,8,9,6,5}
Applying selection sort :
1st pass - 5 {7,8,9,6} 
2nd pass - 5, 6 {7,8,9} 
3rd pass - 5, 6, 7 {8,9}
4th pass - 5,6,7,8 {9} ( array sorted)
So, we need 4 passes/iterations to sort the array using selection sort.

Bubble sort work by the principle of finding the max element from the array and pushing it to the end.
Applying bubble sort on {7,8,9,6,5}
1st pass- {7,8,6,5} 9 
2nd pass - {7,6,5}  8, 9
3rd pass- {6,5} 7, 8, 9
4th pass - {5} 6, 7, 8, 9 ( array sorted )
So, we need 4 passes to sort the array using bubble sort.
Both selection and bubble sort takes (n-1) passes / iteration to sort the array. 
Free Test
Community Answer
The given array is a = {7,8,9,6,5}. The number of iterations in select...
Selection Sort and Bubble Sort

Selection Sort:
- Selection Sort is a simple comparison-based sorting algorithm.
- It works by dividing the array into two parts - sorted and unsorted.
- In each iteration, the smallest element from the unsorted part is selected and placed at the beginning of the sorted part.
- This process continues until the entire array is sorted.

Bubble Sort:
- Bubble Sort is another simple comparison-based sorting algorithm.
- It works by repeatedly swapping adjacent elements if they are in the wrong order.
- In each iteration, the largest element in the unsorted part "bubbles up" to its correct position.
- This process continues until the entire array is sorted.

Given Array:
a = {7, 8, 9, 6, 5}

Selection Sort iterations:
- In the first iteration, 5 (the smallest element) is selected and placed at the beginning. The array becomes: {5, 8, 9, 6, 7}
- In the second iteration, 6 (the next smallest element) is selected and placed after 5. The array becomes: {5, 6, 9, 8, 7}
- In the third iteration, 7 is selected and placed after 6. The array becomes: {5, 6, 7, 8, 9}
- In the fourth iteration, 8 is selected and placed after 7. The array remains the same: {5, 6, 7, 8, 9}

Bubble Sort iterations:
- In the first iteration, 7 and 8 are compared. Since 8 is greater, they are swapped. The array becomes: {8, 7, 9, 6, 5}
- In the second iteration, 8 and 9 are compared. Since they are in the correct order, no swap occurs. The array remains the same: {8, 7, 9, 6, 5}
- In the third iteration, 9 and 6 are compared. Since 9 is greater, they are swapped. The array becomes: {8, 7, 6, 9, 5}
- In the fourth iteration, 9 and 5 are compared. Since 9 is greater, they are swapped. The array becomes: {8, 7, 6, 5, 9}

Conclusion:
- The number of iterations in the selection sort is 4, while the number of iterations in the bubble sort is 4.
- Therefore, the correct answer is option 'A', i.e., 4 iterations for selection sort and 4 iterations for bubble sort.
Explore Courses for Humanities/Arts exam

Top Courses for Humanities/Arts

Question Description
The given array is a = {7,8,9,6,5}. The number of iterations in selection sort and bubble sort respectively are __________.a)4 and 4.b)5 and 4.c)3 and 5d)5 and 5Correct answer is option 'A'. Can you explain this answer? for Humanities/Arts 2025 is part of Humanities/Arts preparation. The Question and answers have been prepared according to the Humanities/Arts exam syllabus. Information about The given array is a = {7,8,9,6,5}. The number of iterations in selection sort and bubble sort respectively are __________.a)4 and 4.b)5 and 4.c)3 and 5d)5 and 5Correct answer is option 'A'. Can you explain this answer? covers all topics & solutions for Humanities/Arts 2025 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for The given array is a = {7,8,9,6,5}. The number of iterations in selection sort and bubble sort respectively are __________.a)4 and 4.b)5 and 4.c)3 and 5d)5 and 5Correct answer is option 'A'. Can you explain this answer?.
Solutions for The given array is a = {7,8,9,6,5}. The number of iterations in selection sort and bubble sort respectively are __________.a)4 and 4.b)5 and 4.c)3 and 5d)5 and 5Correct answer is option 'A'. Can you explain this answer? in English & in Hindi are available as part of our courses for Humanities/Arts. Download more important topics, notes, lectures and mock test series for Humanities/Arts Exam by signing up for free.
Here you can find the meaning of The given array is a = {7,8,9,6,5}. The number of iterations in selection sort and bubble sort respectively are __________.a)4 and 4.b)5 and 4.c)3 and 5d)5 and 5Correct answer is option 'A'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of The given array is a = {7,8,9,6,5}. The number of iterations in selection sort and bubble sort respectively are __________.a)4 and 4.b)5 and 4.c)3 and 5d)5 and 5Correct answer is option 'A'. Can you explain this answer?, a detailed solution for The given array is a = {7,8,9,6,5}. The number of iterations in selection sort and bubble sort respectively are __________.a)4 and 4.b)5 and 4.c)3 and 5d)5 and 5Correct answer is option 'A'. Can you explain this answer? has been provided alongside types of The given array is a = {7,8,9,6,5}. The number of iterations in selection sort and bubble sort respectively are __________.a)4 and 4.b)5 and 4.c)3 and 5d)5 and 5Correct answer is option 'A'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice The given array is a = {7,8,9,6,5}. The number of iterations in selection sort and bubble sort respectively are __________.a)4 and 4.b)5 and 4.c)3 and 5d)5 and 5Correct answer is option 'A'. Can you explain this answer? tests, examples and also practice Humanities/Arts tests.
Explore Courses for Humanities/Arts exam

Top Courses for Humanities/Arts

Explore Courses
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev